package com.cy.jt.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @description: 自定义填充实现类
 * @author: LiuXingYu
 * @date: 2021/8/4 21:21
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {


    @Override
    public void insertFill(MetaObject metaObject) {
        //设定时间变量
        /*Date date = new Date();
        this.setFieldValByName("created", date, metaObject);
        this.setFieldValByName("updated", date, metaObject);*/
        this.setFieldValByName("status", true, metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        /*this.setFieldValByName("updated",new Date(),metaObject);*/
    }
}
